package com.iqik.sc.ns.config;

import com.alibaba.csp.sentinel.slots.block.BlockException;

import javax.servlet.http.HttpServletResponse;

public class UserControllerHandler {

    public static String loginBlockHandler(HttpServletResponse response, String email,
                                           String password, BlockException blockException) {
        System.out.println("login block");
        return "Nothing";
    }

    public static String loginFallback(HttpServletResponse response, String email,
                                           String password) {
        System.out.println("login exception");
        return "Nothing";
    }

    public static String registerBlockHandler(HttpServletResponse response, String email,
                                           String password, String code, BlockException blockException) {
        System.out.println("register block");
        return "{\"status\": \"overdue\"}";
    }

    public static String registerFallback(HttpServletResponse response, String email,
                                       String password, String code) {
        System.out.println("register exception");
        return "{\"status\": \"overdue\"}";
    }

    public static String isRegisterBlockHandler(String email, BlockException blockException) {
        System.out.println("isRegister block");
        return "true";
    }

    public static String isRegisterFallback(String email) {
        System.out.println("isRegister exception");
        return "true";
    }

    public static String infoBlockHandler(String token, BlockException blockException) {
        System.out.println("isRegister block");
        return "true";
    }

    public static String infoFallback(String token) {
        System.out.println("isRegister exception");
        return "true";
    }

}
